<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr =  [{name:"张三",age:20},{name:"李四",age:23},{name:"王五",age:19}];
        //  1.forEach循环 打印出名字和年龄
        // 2.map循环一个 arr出来
        // 3.filter筛选出所有年龄大于或者等于20岁的人；
        
        {
            arr.forEach(function( item , key , arr ){
                console.log( item["name"] , item["age"] );
            })
        }
        {
            let res = arr.map( function ( item , key , arr ){
                return item ;
            })
            console.log(res);
        }
        {
            let res = arr.filter(function( item , key , arr ){
                return item.age >= 20 ;
            })
            console.log(res);
        }
    </script>
</body>
</html>